<?php
$id = $_GET['id'];
$row = DB::get_row("SELECT * FROM app_user WHERE Id = '{$id}'");
?>
<div class="container-fluid">

<div class="panel panel-primary">
<div class="panel-heading">
    修改用户-<i id="id"><?=$row['Id']?></i>
  </div>
  <div class="panel-body">
	<div class="input-control has-label-left">
    <input type="text" class="form-control" id="username" value="<?=$row['user']?>">
    <label for="inputAccountExample3" class="input-control-label-left text-right">账号:</label>
  </div><br>
        (密码留空为默认值：123456)
  <div class="input-control has-label-left">
    <input type="password" class="form-control" id="password" value="<?=$row['pass']?>">
    <label for="inputAccountExample3" class="input-control-label-left text-right">密码:</label>
  </div><br>
  <div class="input-control has-label-left">
    <input type="text" class="form-control" id="money" value="<?=$row['money']?>">
    <label for="inputAccountExample3" class="input-control-label-left text-right">金币:</label>
  </div><br>
  (默认为非会员)
   <div class="radio-primary"><input type="radio" name="vip" value="1"><label for="primaryradio1">会员</label></div>
<div class="radio-primary"><input type="radio" name="vip" value="0"><label for="primaryradio2">非会员</label></div>
	<center><button class="btn btn-info" id="ok">修改</button></center>
  </div>
</div>
<script>
$('.btn').on('click', function() {
    $.post("../api.php",
    {
        index:'setuser',
        id: $("#id").text(),
        username: $("#username").val(),
        password: $("#password").val(),
        money: $("#money").val(),
        vip: $('input:radio:checked').val()
    },
    function(data,status){
        var json = JSON.parse(data);
        if (json['code'] == 0) {
          new $.zui.Messager(json['msg'], {
            icon: 'bell' // 定义消息图标
        }).show();
        }else{
          new $.zui.Messager(json['msg'], {
            icon: 'bell' // 定义消息图标
        }).show();
        }
    });
});
</script>
</div>
</body>
</html>